package org.example.service.impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.example.entity.Consultant;
import org.example.mapper.ConsultantMapper;
import org.example.service.ConsultantService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Collections;
import java.util.List;

/**
 * @ClassName ConsultantServiceImpl
 * @Description TODO
 * @Author yuezhijie
 * @Date 2025年08月13日 11:30
 * @Version 1.0
 */
@Service
public class ConsultantServiceImpl implements ConsultantService {
    @Autowired
    private ConsultantMapper consultantMapper;

    @Override
    public PageInfo<Consultant> selectConsultantAndLevel(Consultant consultant, int pageNum, int pageSize) {
        PageHelper.startPage(pageNum,pageSize);
        List<Consultant> consultants = consultantMapper.selectConsultantAndLevel(consultant);
        PageInfo<Consultant> pageInfo = new PageInfo<>(consultants);
        return pageInfo ;
    }

    @Override
    public Consultant selectConsultantById(int id) {
        Consultant consultant = consultantMapper.selectConsultantById(id);
        return consultant;
    }

    @Override
    public List<Consultant> selectpriceById(int id) {
        List<Consultant> consultants = consultantMapper.selectpriceById(id);
        return consultants;
    }

    @Override
    public PageInfo<Consultant> selectConsultantByName(Consultant consultantName, int pageNum, int pageSize) {
        PageHelper.startPage(pageNum,pageSize);
        List<Consultant> consultants = consultantMapper.selectConsultantByName(consultantName);
        PageInfo<Consultant> pageInfo = new PageInfo<>(consultants);
        return pageInfo ;
    }

    @Override
    public List<Consultant> selectAnswerById(int id) {
        List<Consultant> consultants= consultantMapper.selectAnswerById(id);
        return consultants;
    }



    @Override
    public List<Consultant> selectCourseById(int id) {
        List<Consultant> consultants = consultantMapper.selectCourseById(id);
        return consultants;
    }

    @Override
    public List<Consultant> findAll(int id) {
        List<Consultant> all = consultantMapper.findAll(id);
        return all;
    }

    @Override
    public List<Consultant> selectAll(Consultant consultant) {
        List<Consultant> consultants = consultantMapper.selectAll(consultant);
        return consultants;
    }

    @Override
    public List<Consultant> selectStar(int id) {
        List<Consultant> consultants = consultantMapper.selectStar(id);
        return consultants;
    }

    @Override
    public List<Consultant> getConsultantsAndLevelAndTags(String levelName, String tag, String address, String gender) {
        List<Consultant> consultantsAndLevelAndTags = consultantMapper.getConsultantsAndLevelAndTags(levelName, tag, address, gender);
        return consultantsAndLevelAndTags ;
    }

//    @Override
//    public List<Consultant> selectArticleById(int id) {
//        List<Consultant> consultants = consultantMapper.selectArticleById(id);
//        return consultants;
//    }

    @Override
    public List<Consultant> getConsultantAndLevelAndTag(String level, String tag) {
        List<Consultant> consultantAndLevelAndTag = consultantMapper.getConsultantAndLevelAndTag(level, tag);
        return consultantAndLevelAndTag;
    }


}
